﻿#ifndef MSGWEBVIEW_H
#define MSGWEBVIEW_H

#include <QObject>
#include<QWebEngineView>
#include<QtWebChannel>

class msgWebObj:public QObject{
    Q_OBJECT
    Q_PROPERTY(QString msgLHtmlTmpl MEMBER m_msgLeftTmpl NOTIFY signalMsgHtml)
    Q_PROPERTY(QString msgRHtmlTmpl MEMBER m_msgRightTmpl NOTIFY signalMsgHtml)
public:
    msgWebObj(QObject*parent);
signals:
    void signalMsgHtml();
private:
    QString m_msgLeftTmpl;
    QString m_msgRightTmpl;
private:
    void initHtml();
    QString getHtml(QString html);
};

class msgWebView : public QWebEngineView
{
    Q_OBJECT
public:
    msgWebView(QWidget*parent);
    ~msgWebView();
    void appendMsg(QString msg,QString obj="");
private:
    QWebChannel*m_channel;
};

#endif // MSGWEBVIEW_H
